//
// Created by win10 on 2024/12/20.
//
#include <stdio.h>

int binary_search(int arr[], int n, int target) {
    int low = 0,high = n - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (arr[mid] == target) {
            return mid;
        }else if (arr[mid] < target) {
            low = mid + 1;
        }else {
            high = mid - 1;
        }
    }
}

int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    int arr[n];
    for (int i = 0; i < n; i++) {
        scanf("%d",&arr[i]);
    }
    int targets[m];
    // 读入要查找的目标元素
    for (int i = 0; i < m; i++) {
        scanf("%d", &targets[i]);
    }
    for (int i = 0; i < m; i++) {
        printf("%d%s",binary_search(targets, n, targets[i]),i == m-1 ? "" : " ");
    }

}

